





  <template>
  <el-form ref="form" :model="form" rules="rules" inline="true"  label-width="120px">


    <!-- <div v-if="form.Status!=2" style="padding-left: 20px;padding-top:  10px;text-align:left;">

      <el-button type="primary"  @click="open" icon="el-icon-search">打开项目</el-button>
      <el-button type="primary" @click="confirmData(0)">保存</el-button>
      <el-button type="primary" @click="confirmData(2)">提交</el-button>
    </div> -->

   


  <el-tabs type="border-card">
        <el-tab-pane label="兼职招聘津贴设置">

          <el-form :model="form" :inline="true" label-width="120px" label-position="left">
           

<el-form-item label="状态" prop="UsageMode">
                    <el-radio-group v-model="form.Status">
                      <el-radio :label="item.IDXNO" name="Status" v-for="(item) in selectlist" v-if="item.IDXUP=='02'">
                        {{item.NAME}}
                        </el-radio>
                    </el-radio-group>
                  </el-form-item>

           
            <br />
            <el-form-item label="开始日期：">
              <el-date-picker  v-model="form.StartDate" placeholder=" 开始日期" />
            </el-form-item>
            <el-form-item label="结束日期：">
              <el-date-picker  v-model="form.EndDate" placeholder=" 结束日期" />
            </el-form-item>
            <br />
           
            <el-form-item label="出勤天数：">
              <el-input v-model="form.Days" placeholder=" 出勤天数" />
            </el-form-item>
            <el-form-item label="总金额：">
              <el-input v-model="form.Cost" placeholder=" 总金额" />
            </el-form-item>
  <br />
             <el-form-item label="备注：">
              <el-input v-model="form.Remark1" placeholder=" 备注" />
            </el-form-item>
              
              <br />

 
            <el-form-item label="添加人：">
             
              <el-input :disabled="true" v-model="form.CreatedByName" placeholder=" 添加人" />
            </el-form-item>

             <el-form-item label="添加时间：">
              <el-input :disabled="true" v-model="form.CreatedOn" placeholder=" 添加时间" />
            </el-form-item>

                <br />
             <el-form-item label="修改人：">
              <el-input :disabled="true" v-model="form.CreatedByName" placeholder=" 修改人" />
            </el-form-item>

             <el-form-item label="修改时间：">
              <el-input :disabled="true" v-model="form.ModifyedOn" placeholder=" 修改时间" />
            </el-form-item>

               
          </el-form>

        </el-tab-pane>




     
     

      </el-tabs>
   
    <div style="text-align:right;">
        <!-- <el-button type="danger" @click="closetab">取消</el-button> -->
        <el-button type="primary" @click="confirmData(0)">保存</el-button>
      </div>


  

        <el-dialog :visible.sync="dialogTableVisible" :title="角色" customClass="customWidth" width="60%">
          <el-form :model="name" label-width="80px" label-position="left">
            <v-RoleOpen @FunRoleAdd="FunRoleAdd"></v-RoleOpen>
          </el-form>

        </el-dialog>


  </el-form>
</template>
<style>
  .customWidth {
    width: 80%;
    height: 500px
  }
</style>

<script>

  import path from 'path'
  import { deepClone } from '@/utils'

  import { updateForm, DeleteForm,DeleteRow } from '@/api/RecruitmentSubsidySetForm'
  import elementIcons from '../icons/element-icons'

  import vRoleOpen from '../Common/RoleOpen'
  export default {

    components: {
  
       vRoleOpen
    },

    props: {
      inputName: String,
      required: true
    },
    data() {
      return {
        activeName: 'first',
        form: [],
     
        selectlist:[],
      
        TMJobName:[],
        multipleTable: [],
        dialogTableVisible: false,
     
        where:""
       
    }},
    created: function () {



      this.DataListData();



    },

    methods: {

      async DataListData() { // 提交数据，需要修改


       

        if (this.inputName == null) {
          this.inputName = this.$route.query.billID;
        }

        



        const result = await updateForm({ billID: this.inputName, IsPostBack: false })







        this.form = result.data1.Table[0];

      
        this.selectlist = result.data3.Table;
      
     
        if (result.code === 20000) {



        } else {
          this.$notify({
            title: 'error',

            message: result.message,
            type: 'error'
          })
        }
      }
      ,
      async confirmData(submit) { // 提交数据，需要修改


         const Fresult = true;
         if (submit == 2) {
         
            this.$refs["form"].validate((valid) => {
          if (!valid) {
            this.$notify({
              title: "不能提交",
              dangerouslyUseHTMLString: true,
              message: "不可为空，不能提交",
              type: "error"
            });
            Fresult = false;
            return false;

          } 
            });

          //  if ( this.formDetail.PaymentDate == null) {

          //  this.$notify({
          //     title: "不能提交",
          //     dangerouslyUseHTMLString: true,
          //     message: "付款日期不可为空，不能提交",
          //     type: "error"
          //   });
          //   Fresult = false;
          //  }



        //    if ( this.formDetail.PaymentAmount == null) {

        //    this.$notify({
        //       title: "不能提交",
        //       dangerouslyUseHTMLString: true,
        //       message: "付款金额不可为空，不能提交",
        //       type: "error"
        //     });
        //     Fresult = false;
        // }

           

         }

       



         
        if (Fresult) {

          const result = await updateForm({ HeadDate: JSON.stringify(this.form), billID:this.form.RecruitmentSubsidyNo, IsPostBack: true, submit: submit })

          this.form = result.data1.Table[0];
          
        

          if (result.code === 20000) {
            //const { description, key, name } = this.EditObj
            this.dialogVisible = false
            this.$notify({
              title: '保存成功',
              dangerouslyUseHTMLString: true,
              message: '',
              type: 'success'
            })
            this.getDataList()
            this.roles = []
          } else {
            this.$notify({
              title: '保存失败',
              dangerouslyUseHTMLString: true,
              message: '',
              type: 'error'
            })
          }
        }
      }
      ,

      //editUserInfo(index) {
      //  this.isEditObj[index].a = false;
      //}
      //checkEditUserInfo(index) {      //编辑用户信息
      //  this.isEditObj[index].a = true;
      //},
      //cancelEditUserInfo(index) {
      //  this.isEditObj[index].a = true;
      //}
      select_Cust() {
        this.CustomerRow = this.Customerlist.filter(item => item.CustomerNo === this.form.CustomerNo)[0];//获取选中行

        this.form.CustomerName = this.CustomerRow.CustomerName;//赋值

      },
      //增加行
      addRow(types) {
        let list = {
        };
        

        if (types == 1) {
          this.TMJobName.push(list);
        } 





      },
      goBack() {
      this.$router.go(-1)// 返回
     // 关闭子页面
      this.$store.state.tagsView.visitedViews.splice(this.$store.state.tagsView.visitedViews.findIndex(item => item.path === this.$route.path), 1)
      this.$router.push(this.$store.state.tagsView.visitedViews[this.$store.state.tagsView.visitedViews.length - 1].path)
    },
      
closetab(index){
  //根据index删除tab组中的tab
  this.$store.dispatch('tagsView/delView', this.$route)
// 返回上一步路由
  this.$router.go(-1)
  
},
      // 删除方法
      // 删除选中行
       delData({ $index, row }, typesID) {
        this.$confirm("确定删除该记录吗?", "警告" , {
          confirmButtonText: "确认",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(async () => {
            if (typesID == 1) {
              this.TMJobName.splice($index, 1);
            } 

            if (row.ID == null) {
              return false;
            }

            const result = await DeleteRow({
              ID: row.ID,
              billID: this.inputName,
              types: typesID,
              IsPostBack: false
            });

            //if (typesID == 1) {
            //  this.GuarantorsList = result.data1.Table;
            //} else if (typesID == 2) {
            //  this.GuarantPerList = result.data1.Table;
            //} else if (typesID == 3) {
            //    this.CollateralDataList = result.data1.Table;
            //}

            this.$message({
              type: "success",
              message: "已删除!"
            });
          })
          .catch(err => {
            console.error(err);
          });
      },


       select_status(val) {

        this.$forceUpdate();

      },
      openJob() {

        this.dialogTableVisible = true;
     
      }, FunRoleAdd: function (Rows) {//添加部门

  for (let v of Rows) {
  this.multipleTable=v;
  let row = {
        SpecialPost: this.multipleTable.RoleCode,
        SpecialPostName: this.multipleTable.RoleName,
        Rolelevel: this.multipleTable.Rolelevel
      
      }

       this.TMJobName.push(row) 

   }

        this.dialogTableVisible = false;

      }

    }

  }

</script>


